package com.xique.park.controller.client.web.service.service.impl;

import com.xique.common.core.utils.DateUtils;
import com.xique.park.controller.client.web.bean.domain.ClientLoginInfo;
import com.xique.park.controller.client.web.mapper.ClientLoginInfoMapper;
import com.xique.park.controller.client.web.service.service.IClientLoginInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 系统访问记录Service业务层处理
 *
 * @author caogq
 * @date 2021-07-22
 */
@Service
public class ClientLoginInfoServiceImpl implements IClientLoginInfoService
{
    @Autowired
    private ClientLoginInfoMapper clientLoginInfoMapper;

    /**
     * 查询系统访问记录
     *
     * @param infoId 系统访问记录ID
     * @return 系统访问记录
     */
    @Override
    public ClientLoginInfo selectClientLoginInfoById(Long infoId)
    {
        return clientLoginInfoMapper.selectById(infoId);
    }

    /**
     * 查询系统访问记录列表
     *
     * @param clientLoginInfo 系统访问记录
     * @return 系统访问记录
     */
    @Override
    public List<ClientLoginInfo> selectClientLoginInfoList(ClientLoginInfo clientLoginInfo)
    {
        return clientLoginInfoMapper.selectClientLoginInfoList(clientLoginInfo);
    }

    /**
     * 新增系统访问记录
     *
     * @param clientLoginInfo 系统访问记录
     * @return 结果
     */
    @Override
    public int insertClientLoginInfo(ClientLoginInfo clientLoginInfo)
    {
        clientLoginInfo.setAccessTime(DateUtils.getNowDate());
        return clientLoginInfoMapper.insert(clientLoginInfo);
    }

    /**
     * 修改系统访问记录
     *
     * @param clientLoginInfo 系统访问记录
     * @return 结果
     */
    @Override
    public int updateClientLoginInfo(ClientLoginInfo clientLoginInfo)
    {
        return clientLoginInfoMapper.updateById(clientLoginInfo);
    }

    /**
     * 批量删除系统访问记录
     *
     * @param infoIds 需要删除的系统访问记录ID
     * @return 结果
     */
    @Override
    public int deleteClientLoginInfoByIds(Long[] infoIds)
    {
        return clientLoginInfoMapper.deleteBatchIds(Arrays.asList(infoIds));
    }

    /**
     * 删除系统访问记录信息
     *
     * @param infoId 系统访问记录ID
     * @return 结果
     */
    @Override
    public int deleteClientLoginInfoById(Long infoId)
    {
        return clientLoginInfoMapper.deleteById(infoId);
    }

    @Override
    public int updateSysUserId(List<ClientLoginInfo> list) {
        return clientLoginInfoMapper.updateSysUserId(list);
    }
}
